import React, { Component } from 'react';
import { observable, useStrict, action } from 'mobx';
import { observer } from 'mobx-react';
import BaseApp from './BaseApp';

@observer
class Msg2 extends BaseApp {

    @observable name = "";

    constructor(props){
        super(props);

        this.name = this.store.name;

        this.onChange = (event)=>{
            this.name = event.currentTarget.value;
            this.store.setName(this.name);
        }
    }
    render() {
        return (
            <p className="App-intro">
                起个名吧：<input type="text" value={this.name} onChange={this.onChange}/>
            </p>
        );
    }
}

export default Msg2;
